interface IdFunc<T> {
  id(value: T): T
  func(): T[]
}
let idFunc: IdFunc<number> = {
  id(value) {
    return value
  },
  func() {
    return [1, 2, 3]
  }
}

//泛型类
class MyClass<T> {
  defaultValue: T
  add(x: T, y: T) {
    console.log(this.defaultValue, x, y);
    return x
  }
  constructor(val: T) {
    this.defaultValue = val
  }
}
let mc: MyClass<number> = new MyClass(12)
mc.add(5, 6)